package com.chinasoft.exam.mapper;

import com.chinasoft.exam.pojo.OrderItem;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface OrderItemMapper {

    // 对应 xml
    Integer insert(OrderItem orderItem);

    @Insert("insert into tb_order_item values(null, " +
            "#{goodsName}, #{goodsPrice}, #{count}, #{orderId}" +
            ")")
    Integer insert2(OrderItem orderItem);

    @Select("select * from tb_order_item where id = #{id}")
    OrderItem selectById(Integer id);

    @Update("update tb_order_item set " +
            " goods_name = #{goodsName}, " +
            " goods_price = #{goodsPrice}, " +
            " count = #{count}, " +
            " order_id = #{orderId} " +
            "where id = #{id}")
    Integer update(OrderItem orderItem);

    @Delete("delete from tb_order_item where id = #{id}")
    Integer deleteById(Integer id);
}
